package com.example.studyaop.filter;

import org.springframework.web.filter.OncePerRequestFilter;

import javax.servlet.*;
import javax.servlet.annotation.WebFilter;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;

/**
 * @Author: hanll
 * @ClassName: WebFilter
 * @Date: 2022-11-16 11:50
 * @Version: 1.0
 * @Description:
 */
@WebFilter(filterName = "webFilterConfig", urlPatterns = "/*")
public class WebFilterConfig extends OncePerRequestFilter {

    @Override
    protected void doFilterInternal(HttpServletRequest request, HttpServletResponse response, FilterChain filterChain) throws ServletException, IOException {
        String host = request.getHeader("Host");
        System.err.println("完整地址：http://"+ host + request.getRequestURI());
        filterChain.doFilter(request, response);
    }
}
